﻿//using Microsoft.AspNetCore.Mvc;
//using Microsoft.AspNetCore.Mvc.Filters;
//using RuoVea.ExConfig;

//namespace RuoVea.Gantt.Controllers
//{
//    public class BaseController : Controller
//    {
//        public override   void OnActionExecuting(ActionExecutingContext context)
//        {
//            var authenticationScheme = "Cookies";
//            var authority = Appsettings.app("Authority:AuthorityUrl")?.ToString(); // 授权服务器地址 //"https://localhost:7188";
//            var clientId = Appsettings.app("Authority:ClientId")?.ToString();//"MvcClient";
//            var clientSecret = Appsettings.app("Authority:ClientSecret")?.ToString();// "codetest_secret";
//            var callbackPath = Appsettings.app("Authority:CallbackPath")?.ToString();// "/signin-oidc";
//            var responseType = Appsettings.app("Authority:ResponseType")?.ToString();// "code";
//            var hostUrl = Appsettings.app("BaseFile:HostUrl")?.ToString();

//            var data = context.HttpContext.User;
//            string uri = $"{authority}/auth/login?ReturnUrl=/connect/authorize/callback?client_id=JsClient&redirect_uri=https://localhost:8896/JsClient/callback&response_type=id_token token&scope=openid profile orderApi&state=10fd310321464915bf5ff6890b78917e&nonce=030e6d47b69b4e7cb75ff95dd6eb7ad5";
//            //没有通过登录验证授权
//            Console.WriteLine(uri); 
//            if (data.Identity.IsAuthenticated == false)
//            {
//                HttpContext.Response.Redirect("https://baidu.com");
//                //await  HttpContext.Response.WriteAsync(string.Format("window.location.href='{0}';", uri));
//                HttpContext.Response.Redirect(uri);
//            }
//        }
//    }
//}
